Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #126 #127

Merged
merged 2 commits into from
Nov 16, 2022
Merged

Issue #126 #127

merged 2 commits into from
Nov 16, 2022

Conversation

jinglemansweep
Copy link
Contributor

Added bytearray('\x00') to the list of expected "noop" returns from the socket.

Added bytearray('\x00') to the list of expected "noop" returns from
the socket.
Copy link
Contributor

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THanks! One question.

@dhalbert
Copy link
Contributor

Use pre-commit or run the code through black to get rid of the failure: https://learn.adafruit.com/improve-your-code-with-pylint

Fixed linting errors using Black
Copy link
Contributor

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering whether the fact that you have to check for one byte of zeros is a bug in the underlying network code. But I think this is a good workaround to add to the library for now.

@brentru Do you have any comment about this from an MQTT protocol point of view?

@brentru
Copy link
Member

brentru commented Nov 16, 2022

@jinglemansweep Hi - thanks for fixing this issue. @dhalbert - I do not think this is a network or a MQTT spec issue, b"\x00 is rx'd after the call to res = self._sock_exact_recv(1).

Considering some in #126 are having issues with non-native wifi, it's possible (don't know, guessing right now) that the issue is within this library's local implementation of _sock_exact_recv() vs the native impl. of _sock_exact_recv() (cc @calcut ☝️ )

        # CPython socket module contains a timeout attribute
        if hasattr(self._socket_pool, "timeout"):
            try:
                res = self._sock_exact_recv(1)
            except self._socket_pool.timeout:
                return None
        else:  # socketpool, esp32spi
            try:
                res = self._sock_exact_recv(1)

Copy link
Member

@brentru brentru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, though, I think this is an OK temporary change and will cause clients to poll faster until we resolve why the socket is rcv'ing a bytearray on some clients.

@dhalbert dhalbert merged commit b707805 into adafruit:main Nov 16, 2022
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Nov 17, 2022
Updating https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT to 6.0.1 from 6.0.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_MiniMQTT#127 from jinglemansweep/main

Updating https://github.com/adafruit/Adafruit_CircuitPython_PortalBase to 1.14.5 from 1.14.4:
  > Merge pull request adafruit/Adafruit_CircuitPython_PortalBase#84 from makermelissa/main
  > Update .pylintrc for v2.15.5
  > Fix release CI files
  > Update pylint to 2.15.5
  > Updated pylint version to 2.13.0
  > Switching to composite actions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants